﻿using System;
using System.ComponentModel.DataAnnotations.Schema;

namespace SDCloudSolution.SDCloud.Entities.Identity.OAuth
{
    /// <summary>
    /// Represents a DB entity with client application settings.
    /// </summary>
    [Table("oauth_client")]
    public class ClientApplicationEntity
    {
        /// <summary>
        /// The OAuth client identifier.
        /// </summary>
        [Column("Id")]
        public int Id { get; set; }

        /// <summary>
        /// The application name.
        /// </summary>
        [Column("Name")]
        public string Name { get; set; }

        /// <summary>
        /// Flag indicates that this application was generated automatically.
        /// </summary>
        [Column("IsAutoGenerated")]
        public bool IsAutoGenerated { get; set; }

        /// <summary>
        /// The unique client identifier (GUID).
        /// </summary>
        [Column("ApplicationKey")]
        public string ClientId { get; set; }

        /// <summary>
        /// The unique client secret key.
        /// </summary>
        [Column("SharedSecret")]
        public string ClientSecret { get; set; }

        /// <summary>
        /// The application type.
        /// </summary>
        //[Column("ApplicationType")]
        //public ApplicationType ApplicationType { get; set; }

        /// <summary>
        /// The attached person for this instance of client.
        /// </summary>
        [Column("UserId")]
        public int? UserId { get; set; }

        /// <summary>
        /// Flag indicates that this application is active for allowing authorization.
        /// </summary>
        [Column("IsActive")]
        public bool IsActive { get; set; }

        /// <summary>
        /// Date when this application was logged in system.
        /// </summary>
        [Column("LastActiveDateUtc")]
        public DateTime LastActiveDateUtc { get; set; }
    }
}
